// pages/head/head.js

const app=getApp()
Page({

  onShareAppMessage() {
    return{
      title:'欢迎使用Ai小齿助手',
      path: '/pages/head/head?type=10'
    }
  },
  /**
   * 页面的初始数据
   */
  data: {
    images: [
      'https://gitee.com/ToBugCoding/my-photo-bed/raw/master/imgurl/%E5%85%AC%E5%8F%B8%E5%B0%8F%E7%A8%8B%E5%BA%8F%E9%87%8D%E5%86%99/%E5%8F%A3%E8%85%94%E6%A3%80%E6%9F%A5.png',
      'https://gitee.com/ToBugCoding/my-photo-bed/raw/master/imgurl/%E5%85%AC%E5%8F%B8%E5%B0%8F%E7%A8%8B%E5%BA%8F%E9%87%8D%E5%86%99/%E6%8E%A2%E5%A4%B4%E6%A3%80%E6%9F%A52.png',
      'https://gitee.com/ToBugCoding/my-photo-bed/raw/master/imgurl/%E5%85%AC%E5%8F%B8%E5%B0%8F%E7%A8%8B%E5%BA%8F%E9%87%8D%E5%86%99/%E5%8E%86%E5%8F%B2%E6%8A%A5%E5%91%8A.png'
    ],
    loadedImages: 0,
    ifready:true,
    bottomshow:"none",
    bottomArticle:["step1:刷后牙外侧面时，牙齿咬在一起，牙刷进入后牙的外面，然后转圈，刷毛从上牙牙龈拖拉至下牙。","step2:刷到前牙的时候，可以发“1”的音，这时门牙是对着的，然后牙刷在牙齿上面继续连续地圆弧形转动。","step3:刷后牙内侧面时，刷毛朝向牙面，来来回回反复刷。","step4:刷到前牙内侧面时，将牙刷竖起，来回上上下下，慢慢移动短距离刷，从一侧到另一侧。","step5:刷牙齿咀嚼面时，将刷毛放在牙面上，来来回回刷。","step6:最后一颗牙的最后面容易遗漏，所以刷该面时，半张口，刷头竖起，从该牙的内侧面，沿着牙龈，转过该牙的最后面，到达外侧面。",],
  },
  clickbottom:function(){
    console.log("click")
    this.setData({
      bottomshow:"block"
    })
  },
  clickbottom2:function(){
    console.log("click")
    this.setData({
      bottomshow:"none"
    })
  },
  turnTo1:function(){
    wx.redirectTo({
      url: "/pages/first/first?userid=11",
    })
  },
  turnTo2:function(){
    wx.redirectTo({
      url: '/pages/blueTooth/blueTooth',
    })
  },
  turnTo3:function(){
    wx.redirectTo({
      url: '/pages/tooth3/tooth3',
    })
  },
  turnTo4:function(){
    wx.redirectTo({
      url: '/pages/tooth4/tooth4',
    })
  },
  onShow:function(){
   

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    var that=this
    if(that.data.ifready!='none'){
      let images = this.data.images;
      images.forEach((imgSrc, index) => {
        wx.getImageInfo({
          src: imgSrc,
          success: () => {
            // 图片加载成功
            this.setData({
              loadedImages: this.data.loadedImages + 1
            });
            if (this.data.loadedImages === images.length) {
              if(this.data.ifready==true)
              {
                setTimeout(() => {
                  that.setData({
                    ifready:'none'
                  })
                }, 500);
              }
            }
          },
          fail: () => {
            // 图片加载失败
            console.log(`图片${index + 1}加载失败`);
          }
        });
      });
    }
},

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady:function(){
    var that=this;
   
  },
})